package org.o14x.alpha.preferences;

import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.o14x.alpha.Activator;
import org.o14x.alpha.ui.controller.UIController;
import org.o14x.alpha.util.Messages;

/**
 * The file browser preferences page
 * 
 * @author Olivier DANGREAUX
 */
public class FileBrowserPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
	/**
	 * UIController.
	 */
	private UIController uiController;

	/**
	 * Creates a new instance of FileBrowserPreferencePage.
	 */
	public FileBrowserPreferencePage() {
		super(GRID);
		setPreferenceStore(Activator.getDefault().getPreferenceStore());
		setDescription(Messages.getString("FileBrowserPreferencePage.description")); //$NON-NLS-1$
	}

	/**
	 * Creates FieldEditors.
	 */
	public void createFieldEditors() {
		addField(new ColumnFieldEditor(PreferenceConstants.FILE_BROWSER_COLUMNS, Messages.getString("FileBrowserPreferencePage.displayed_columns"), getFieldEditorParent(), uiController)); //$NON-NLS-1$
	}

	/* (non-Javadoc)
	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
	 */
	public void init(IWorkbench workbench) {
	}

	/**
	 * Returns the value of uiController.
	 *
	 * @return The value of uiController.
	 */
	public UIController getUiController() {
		return uiController;
	}

	/**
	 * Sets the value of uiController.
	 *
	 * @param uiController The value of uiController to set.
	 */
	public void setUiController(UIController uiController) {
		this.uiController = uiController;
	}
}